%%%-------------------------------------------------------------------
%% @doc game public API
%% @end
%%%-------------------------------------------------------------------

-module(game_app).

-behaviour(application).

-export([start/2, stop/1]).

-include("common.hrl").


start(_StartType, _StartArgs) ->
    Dispatch = cowboy_router:compile([
        {'_', [
            {"/websocket", ws_handler, []}
        ]}
    ]),
    {ok, _} = cowboy:start_clear(http, [{port, ?PORT}], #{
        env => #{dispatch => Dispatch}
    }),

    game_sup:start_link().

stop(_State) ->
    ok.

%% internal functions
